﻿using MediatR;
using T.Personnel.Domain.Dto;
using T.Personnel.Read.API.Application.Command.RegisterCommand;
using T.Personnel.Repository.Interface;

namespace T.Personnel.Read.API.Application.CommandHandler.RegisterHandler
{
    public class GetUserFullHandler : IRequestHandler<GetUserFullCommand, List<ItemsDto>>
    {
        private readonly IRegisterRepository registerRepository;

        public GetUserFullHandler(IRegisterRepository registerRepository)
        {
            this.registerRepository = registerRepository;
        }

        public async Task<List<ItemsDto>> Handle(GetUserFullCommand request, CancellationToken cancellationToken)
        {
            return await registerRepository.GetUserFullAsync(request.PositionId);
        }
    }
}
